<template>
  <component :form="form" :is="getComponent.component" :config.sync="getComponent"></component>
</template>

<script>
import { components } from '@/assembly/index.js'
export default {
  props: {
    config: {
      type: Object,
      default: () => ({})
    },
    form: {
      type: Object,
      require: true
    }
  },
  data() {
    return {}
  },
  computed: {
    getComponent: {
      get() {
        let component
        if (!this.config.component) {
          component = components.filter(item => item.type === this.config.type)?.[0]
        }
        const componentConfig = {
          ...component,
          ...this.config,
        }
        return componentConfig
      },
      set(val) {
        console.log(35, 'set', val);
      }
    }
  },
  created() { },
  mounted() { },
  methods: {

  },
}
</script>

<style scoped lang="scss"></style>